#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QCheckBox>
#include <QLine>
#include <QPainter>
#include <QFrame>
#include <QLabel>
#include <QSignalMapper>
#include <QComboBox>

namespace Ui
{
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void drownHline(int n,QFrame **frame,int x,int y,int weight,int height,int distance);
    void drownHline(int n,QFrame **frame,int x,int y,int weight,int height,int distance,int shift);
    void drownHline(int n,QFrame **frame,int x,int y,int weight,int height,int distance,int yshift,int shift);
    void drownVline(int n,QFrame **frame,int x,int y,int weight,int height,int distance,int xshift,int shift);
    void drowNCheckBox(int n,QCheckBox **checkbox,int x,int y,int weight,int height,int distance);
    void drowNCheckBox(int n,int N,QCheckBox **checkbox,int x,int y,int weight,int height,int distance,int delta);
    void drow4Word(QLabel *label[4],int x,int y,int weight,int height,int distance);
    void drowNImage(int n,QLabel **label,int x,int y,int weight,int height,int distance);
    void drowNImage2(int n,QLabel **label,int x,int y,int weight,int height,int distance);
    void changeLineAfterConnectionColor(int i);
    void changeMLineColor(int i);
    void changeM2LineColor(int i);
    void changeMLineColorAfterInput();
    void changeM2LineColorAfterInput();
    void changeAllLineColorAfterTransimt(int i);
    void changeInformLineColorAfterTransmit(int i);
    void changeGradeMistakeLineColor();
    void changeOutputLineColor();
    int off();
    int offM(int j);
    int offM2(int j);

private:
    Ui::MainWindow *ui;

    int xM1;
    int yM1;
    int Vd;
    int Hd;
    int XConLine;
    int YConLine;
    int WConLine;
    int HConLine;
    int xM4;
    int yM4;
    int Vd4;
    int Hd4;
    int Vd5;
    int Hd5;
    int H5;
    int xM10;
    int yM10;
    int Mdist;
    int xD;
    int yD;
    int Vd2;
    int Hd2;
    int dW;
    int dH;
    int seekLine;
    int signalValue[7];
    int signalValue2[7];
    int signalValue3[3];
    int gradeMistake;
    int mistakeDC[4];
    int signalOutputValue[4];
    int M1;
    int M2;
    int M3;
    int M4;
    int M5;
    int M6;
    int Error;
    int Error_prev;

    QString colorTrue1;
    QString colorTrue0;
    QString colorFalse1;
    QString colorFalse0;
    QString colorDefault;

    QCheckBox *box[4];
    QCheckBox *boxm1[12];
    QCheckBox *boxm2[21];
    QFrame *f[4];
    QFrame *fbus[2];
    QFrame *f1[4];
    QFrame *fm1[4];
    QFrame *fm2[4];
    QFrame *fm3[4];
    QLabel *linp[4];
    QLabel *lm1[4];
    QLabel *lm2[4];
    QLabel *lm3[4];
    QFrame *fme1[4];
    QFrame *fme2[4];
    QFrame *fme3[4];
    QFrame *fme4[7];
    QFrame *fme5[7];
    QFrame *fme6[7];
    QImage *im;
    QImage *im2;
    QLabel *lim[3];
    QFrame *f_A[3];
    QFrame *fVConl[3];
    QFrame *fHConl[3];
    QSignalMapper *boxMapper;
    QSignalMapper *box1Mapper;
    QSignalMapper *box2Mapper;
    QImage *imConLine;
    QLabel *LConLine;
    QFrame *f_con[8];
    QFrame *f_B[4];
    QFrame *fm4[7];
    QFrame *fm5[7];
    QFrame *fm6[7];
    QLabel *lim2[3];
    QFrame *f_C[3];
    QFrame *f_D[3];
    QFrame *f_E[3];
    QImage *imDC;
    QLabel *LDC;
    QFrame *f_F[3];
    QLabel *lim3[4];
    QFrame *f_G[3];
    QFrame *f_H[3];
    QFrame *f_I[3];
    QFrame *f_J[3];
    QFrame *f_K[4];
    QFrame *f_L[3];
    QFrame *f_M[3];
    QFrame *f_N[4];
    QComboBox *comboBox;
    QLabel *mistake;

public slots:
    void changeBoxLineColor(int i);
    void changeBox1LineColor(int i);
    void changeBox2LineColor(int i);
    void changeComboBoxLineColor(int i);
};

#endif // MAINWINDOW_H
